package test.amf3;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.HashMap;

import org.junit.Test;

import flex.messaging.endpoints.Endpoint;
import flex.messaging.io.ArrayList;
import flex.messaging.io.SerializationContext;
import flex.messaging.io.amf.ASObject;
import flex.messaging.io.amf.Amf3Input;
import flex.messaging.io.amf.Amf3Output;
import flex.messaging.io.amf.AmfTrace;
import flex.messaging.util.ResourceLoader;

public class amf3coder {

	@SuppressWarnings("unchecked")
	@Test
	public void test() {
		
		SerializationContext  sc=new SerializationContext();

	
		Amf3Output afo = new Amf3Output(sc);
		HashMap<String,Object> obj=new HashMap<String,Object>();
		obj.put("name", "adsfasdf");
		obj.put("pwb", "pwb");
		obj.put("age", 18);
		obj.put("time",System.currentTimeMillis());
//		afo.setOutputStream(out);
		try {
			afo.writeObject(obj);
			afo.writeObjectEnd();
			afo.flush();

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		AmfTrace aft=new AmfTrace();
		aft.write(obj);
		aft.endAMFObject();
//		aft.

		
		Amf3Input in=new Amf3Input(sc);
//		in.setInputStream(afo);
//		in.read(bytes);
//		 in.saveObjectTable();
		
//		afo.addObjectReference(o)
//		fail("Not yet implemented");
	}

}
